/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package logic;

import java.util.Hashtable;

/**
 * WordSetHash
 * @author Jorge Lainfiesta 11142
 * @since Oct 18, 2012
 * @version 1
 */
public class WordSetHash implements WordSet {

    Hashtable<String,String> base;
    
    public WordSetHash(){
        base = new Hashtable<String,String>();
    }
    @Override
    public void add(Word wordObject) {
        if(!base.containsKey(wordObject.getWord()))
            base.put(wordObject.getWord(), wordObject.getType());
    }

    @Override
    public Word get(Word word) {
        String tipo = base.get(word.getWord());
        if(tipo==null)
            return null;
        Word n = new Word();
        n.setWord(word.getWord());
        n.setType(tipo);
        return n;
    }

}
